#ifndef __SERIAL_H__
#define	__SERIAL_H__

/**
  ******************************************************************************
  * @file           : public.h
  * @brief          : Header for *.c file.
  *                   This file contains the common defines of the application.
  * @author			: xiaozhi
  * @attention
  *
  *		Copyright (c) 2023 Technology Co., Ltd.
  *
  *******************************************************************************
  */

#ifdef __cplusplus
extern "C" {
#endif

#define SERIAL_DEV "/dev/ttyACM0"
#define MAX_BUFFER	256
#define TRUE	1
#define FLASE	0

#define msleep(ms) usleep(ms*1000)

#define VERIFICATION	1	/* system time vs gps time, verification deviation */





/*
 * function abstruct : uart initialization
 * parameter illustration: 
 *		[com]: uart number,[baudrate]: baud rate, [databit]: data bit
 *		[stopbit]: stop bit, [parity]: parity
 */
int uart_init(int com, int baudrate, int databit, int stopbit, char parity);
int uart_receive(unsigned char * buffer, int len);
int uart_send(unsigned char * buffer, int len);

int time_analysis(char * pdata);

void * uart_receive_thread_none(void * param);
void * uart_receive_thread(void * param);
void * uart_send_thread(void * param);

/*
 * exception handling.
 */
void __do_abnormal(const char * str);


#ifdef __cplusplus
}
#endif

#endif /* __SERIAL_H__ */
